package com.mdhw.controller;

import com.mdhw.ali.service.AliService;
import com.mdhw.common.annotation.IgnorePermissions;
import com.mdhw.config.R;
import com.mdhw.mili.service.MiliProjectService;
import com.mdhw.mili.service.MiliTokenService;
import com.mdhw.mili.vo.MiliTokenVo;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Slf4j
@RestController
@Api(tags = "米立-接口")
@RequestMapping("mili")
public class MiliController {

    @Autowired
    private MiliTokenService miliTokenService;
    @Autowired
    private MiliProjectService miliProjectService;
    @Autowired
    private AliService aliService;


    @IgnorePermissions
    @GetMapping("/getToken")
    public R<String> getToken(@RequestParam String response,@RequestParam String miyao) throws Exception {
        return R.success(this.aliService.jiemiPhone(response,miyao));
    }


//    @IgnorePermissions
//    @PostMapping("/jiemiPhone")
//    public R<String> jiemiPhone(@RequestBody Map<String,String> params) throws Exception {
//        return R.success(this.aliService.jiemiPhone(params));
//    }


    @IgnorePermissions
    @GetMapping("/get/selectXianquanDevice")
    public R selectXianquanDevice(@RequestParam String deviceJson){
        log.info("支付宝获取到的设备信息 : {}", deviceJson);
        return R.success();
    }
    @IgnorePermissions
    @GetMapping("/get/getAuthCode")
    public R getAuthCode(@RequestParam String code)throws Exception{
        return R.success(aliService.getAuthCode(code));
    }
}
